package io;

import javax.sql.rowset.spi.SyncResolver;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo02 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("String.png");
        FileOutputStream fos = new FileOutputStream("String02.png");
        byte [] data = new byte[1024*10];
        int d;
        long start = System.currentTimeMillis();
        while ((d=fis.read(data))!=-1){
            fos.write(data,0,d);//精准写入复制
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕,耗时："+(end-start)+"毫秒");
        fis.close();
        fos.close();
    }

}
